package com.youkeda.test.threadpool;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @author CoderXshuai
 */
public class Track {
    private static ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(3);

    public static void main(String[] args) {
        Animal animal1 = new Animal("兔子", 5);
        Animal animal2 = new Animal("乌龟", 2);
        threadPool.scheduleAtFixedRate(animal1, 1, 3, TimeUnit.SECONDS);
        threadPool.scheduleAtFixedRate(animal2, 1, 1, TimeUnit.SECONDS);
    }
}
